package com.open.capacity.salary.controller;

import java.util.Map;

import com.open.capacity.commons.Result;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.security.access.prepost.PreAuthorize;
import com.open.capacity.salary.entity.GzUsersalaryPause;
import com.open.capacity.salary.service.GzUsersalaryPauseService;

import com.open.capacity.commons.PageResult;
import javax.validation.Valid;
/**
 * 工资系统-员工暂停发放工资表
 *
 * @author 
 * @email 
 * @date 2021-08-27 17:31:48
 */
@RestController
@RequestMapping("gzusersalarypauses")
@Api(tags = "工资系统-员工暂停发放工资表")
public class GzUsersalaryPauseController {

    @Autowired
    private GzUsersalaryPauseService gzUsersalaryPauseService;

    /**
     * 保存
     */
    @RequestMapping("/saveOrUpdate")
    @PreAuthorize("hasAnyAuthority('gz_usersalary_pause:gzusersalarypause:save')")
    public Result save(@RequestBody @Valid  GzUsersalaryPause gzUsersalaryPause, String keyValue) {
    	 if(StringUtils.isEmpty(keyValue)) {
              gzUsersalaryPauseService.save(gzUsersalaryPause);
	     }else {
          gzUsersalaryPause.setId(keyValue);
          gzUsersalaryPauseService.update(gzUsersalaryPause);
	     }
        return Result.succeed("保存成功");
    }


    /**
     * 删除
     */
    @DeleteMapping("/delete/{id}")
    @PreAuthorize("hasAnyAuthority('gz_usersalary_pause:gzusersalarypause:delete')")
    public Result delete(@PathVariable String  id) {
            gzUsersalaryPauseService.delete(id);
        return Result.succeed("删除成功");
    }

}
